﻿
<%@ Page language="c#" Inherits="Mysoft.Crm.Application.Pages.Tools.FormEditor.Dialogs.Picklist" CodeBehind="Mysoft.Crm.Application.Pages.Tools.dll" %>
<%@ Register TagPrefix="cnt" Namespace="Mysoft.Crm.Application.Controls" Assembly="Mysoft.Crm.Application.Components" %>
<html>
<head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312"/>
<title>下拉类表字段属性</title>
<link rel="stylesheet" type="text/css" href="/_common/styles/global.css">
<link rel="stylesheet" type="text/css" href="/_common/styles/select.css">
<link rel="stylesheet" type="text/css" href="/_nav/tabs.css">
<link rel="stylesheet" type="text/css" href="/Tools/FormEditor/Styles/dialogs.css">
<style>

	BUTTON.edit
	{
		margin-bottom:	5px;
		width:			110px;
	}

</style>
<script language="javascript" src="/_controls/settings.aspx"></script>
<script language="javascript" src="/_common/scripts/global.js"></script>
<script language="javascript" src="/Tools/FormEditor/Scripts/objects.js"></script>
<script language="javascript" src="/Tools/FormEditor/Scripts/fielddialogs.js"></script>
<script language="javascript" src="/Tools/FormEditor/Scripts/dialogs.js"></script>
<script language="javascript" src="/Tools/FormEditor/Scripts/options.js"></script>
<script language="javascript" src="/_controls/util/util.js"></script>
<script language="javascript">

	function window.onload()
	{
		_bAllowNullOption = true;
		
		var oField = window.dialogArguments.Field;
		
		InitializeDialog(oField);
		
		BuildOptions(oField.Options);
		
		_iNextValue = oField.PropertyBag.NextValue;
		
		BuildDefaultValues(oField.Options, oField.PropertyBag.DefaultValue);
		
		Events.children[0].rows[1].click();
	}


	function Ok()
	{
		if (!ValidateDisplayInfo())
		{
			return;
		}
		
		var oOptions = GetOptionObjs();
		
		if (!oOptions)
		{
			//alert( "Drop-down lists must have at least one value." );
			alert("下拉类表至少要有一个值。");
			return;
		}
		
		var oField	= new FieldObj(
						crmDialog.TabName.returnValue,
						crmDialog.SectionName.returnValue,
						crmDialog.FieldName.value,
						crmDialog.FieldLocName.value,
						crmDialog.FieldDesc.value,
						crmDialog.DataType.value,
						(crmDialog.Required.value == "true"),
						crmDialog.OrgRequired.value,
						crmDialog.Span[0].checked,
						new Array(new LocalizedObj(crmDialog.DisplayName.value, ORG_LANGUAGE_CODE)),
						new Array(new LocalizedObj(crmDialog.Label.value, ORG_LANGUAGE_CODE)),
						oOptions,
						_oEvents,
						new PicklistPropertyBag(_iNextValue, GetDefaultValue())
					);
		
		window.returnValue = oField;

		window.close();
	}


	function SelectEventRow()
	{
		UnSelectRow();

		var o = event.srcElement;

		while (o.tagName != "TR")
		{
			o = o.parentElement;
		}

		o.style.backgroundColor = "#adc3e7";
		
		_oEvent = o;
	}


	function UnSelectEventRow()
	{
		if (_oEvent)
		{
			var oRow = _oEvent;

			oRow.style.backgroundColor = "#ffffff";
		}
	}

</script>
</head>
<body>
	<form name="crmDialog">
		<input type="hidden" name="DataType">
		<input type="hidden" name="Required">
		<input type="hidden" name="OrgRequired">
		<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
			<tr>
				<td class="header">
					<div class="header"><!-Drop-down List Field Properties->下拉类表字段属性</div>
					<div class="headerdesc"><!-Modify this drop-down list (picklist) field's properties.->修改下拉类表字段的属性</div>
				</td>
			</tr>
			<tr>
				<td class="main">
					<table width="100%" height="100%" cellspacing="0" cellpadding="0">
						<tr height="25">
							<td>
								<cnt:AppTabBar id="crmTabBar" runat="server"/>
							</td>
						</tr>
						<tr>
							<td>
								<div id="tab0" class="tab" style="display: inline;">
									<fieldset>
										<legend><!-Display Name->显示名&nbsp;</legend>
										<div class="desc">
											<!-Specify the name to display in views, searching, and reporting.->指定在视图、检索和导出报表时显示的名称。
										</div>
										<table cellpadding="0" cellspacing="5" width="100%" style="table-layout: fixed;">
											<col width="50"><col>
											<tr>
												<td class="req"><!-Name->名称</td>
												<td><input name="DisplayName" type="text" maxlength="100"></td>
											</tr>
										</table>
									</fieldset>
									<br>
									<fieldset>
										<legend><!-Label->标识&nbsp;</legend>
										<div class="desc">
											<!-Specify the label for this field in forms.->指定本字段的标识
										</div>
										<table cellpadding="0" cellspacing="5" width="100%" style="table-layout: fixed;">
											<col width="50"><col>
											<tr>
												<td><!-Label->标识</td>
												<td><input name="Label" type="text" maxlength="100"></td>
											</tr>
										</table>
									</fieldset>
									<br>
									<fieldset>
										<legend><!-Location->提示&nbsp;</legend>
										<div class="desc">
											<!-Select the tab and section for this field to appear under. If a tab does not contain sections, it will not appear in the list.->
											选择要显示本字段的标签和区域；如果这个标签不包含区域，本字段将不能显示在列表中。
										</div>
										<div id="FieldLocations">
										</div>
									</fieldset>
								</div>
								<div id="tab1" class="tab">
									<fieldset>
										<legend><!-Layout->布局&nbsp;</legend>
										<div class="desc" style="padding-bottom: 5px;">
											<!-Select the number of columns the field occupies:->选择本字段所占的列的数目：
										</div>
										<table cellpadding="0" cellspacing="5" width="100%" style="table-layout: fixed;">
											<col width="15"><col><col width="85" style="text-align: right;">
											<tr>
												<td><input id="SpanTrue" name="Span" type="radio" class="radio"></td>
												<td><label for="SpanTrue"><!-Two columns->两列</label></td>
												<td>
													<table cellpadding="0" cellspacing="4" width="75" class="example">
														<tr>
															<td class="example">&nbsp;</td>
															<td class="example">&nbsp;</td>
														</tr>
														<tr>
															<td class="example active" colspan="2">&nbsp;</td>
														</tr>
														<tr>
															<td class="example">&nbsp;</td>
															<td class="example">&nbsp;</td>
														</tr>
													</table>
												</td>
											</tr>
											<tr>
												<td colspan="3" height="10"></td>
											</tr>
											<tr>
												<td><input id="SpanFalse" name="Span" type="radio" class="radio"></td>
												<td><label for="SpanFalse"><!-One column->一列</label></td>
												<td>
													<table cellpadding="0" cellspacing="4" width="75" class="example">
														<tr>
															<td class="example">&nbsp;</td>
															<td class="example">&nbsp;</td>
														</tr>
														<tr>
															<td class="example active">&nbsp;</td>
															<td class="example">&nbsp;</td>
														</tr>
														<tr>
															<td class="example">&nbsp;</td>
															<td class="example">&nbsp;</td>
														</tr>
													</table>
												</td>
											</tr>
										</table>
									</fieldset>
								</div>
								<div id="tab2" class="tab">
									<fieldset>
										<legend><!-Schema->显示&nbsp;</legend>
										<div class="desc">
											<!-Provide the following information for the metadata.->为元数据提供下列信息
										</div>
										<table cellpadding="0" cellspacing="5" width="100%" style="table-layout: fixed;">
											<col width="90"><col>
											<tr>
												<td><!-Field Name->字段名</td>
												<td><input name="FieldLocName" type="text" disabled></td>
											</tr>
											<tr>
												<td><!-Schema Name->显示名</td>
												<td><input name="FieldName" type="text" disabled></td>
											</tr>
											<tr>
												<td valign="top"><!-Description->描述</td>
												<td><textarea name="FieldDesc" rows="5" disabled></textarea></td>
											</tr>
										</table>
									</fieldset>
									<br>
									<fieldset>
										<legend><!-Required Level->要求级别&nbsp;</legend>
										<div class="desc">
											<!-Select the requirement level. If the field is system required, you cannot override it.->选择一个要求级别。如果本字段与系统有关联，你不能修改要求级别。
										</div>
										<table cellpadding="0" cellspacing="5" width="100%" style="table-layout: fixed;">
											<col>
											<tr>
												<td id="RequiredLevel">
												</td>
											</tr>
										</table>
									</fieldset>
								</div>
								<div id="tab3" class="tab">
									<fieldset>
										<legend><!-Drop-down List Values->下拉列表值&nbsp;</legend>
										<div class="desc" style="padding-bottom: 5px;">
											<!-Drop-down list values will appear in the same order as they appear in the list.->下拉列表值将像在列表中一样显示相同的顺序
										</div>
										<table cellpadding="0" cellspacing="5" width="100%" style="table-layout: fixed;">
											<col><col width="110">
											<tr>
												<td valign="top">
													<div id="Options" style="background: #ffffff; height: 115px; width: 190px; border: 1px solid #7b9ebd; overflow-y: auto; overflow-x: hidden;">
													</div>
												</td>
												<td valign="top">
													<button class="edit" onclick="MoveUp();"><!-Move Up->向上</button>
													<button class="edit" onclick="MoveDown();"><!-Move Down->向下</button>
													<button class="edit" onclick="Edit();"><!-Edit->编辑</button>
													<button class="edit" onclick="Add();"><!-Add->增加</button>
													<button class="edit" onclick="Delete();"><!-Delete->删除</button>
												</td>
											</tr>
										</table>
										<table cellpadding="0" cellspacing="5" width="100%" style="table-layout: fixed;">
											<col width="80"><col>
											<tr>
												<td><!-Default Value->默认值</td>
												<td id="DefaultValues">
												</td>
											</tr>
										</table>
									</fieldset>
								</div>
								<div id="tab4" class="tab">
									<fieldset>
										<legend><!-Event List->事件列表&nbsp;</legend>
										<table cellpadding="0" cellspacing="5" width="100%" style="table-layout: fixed;">
											<col><col width="110">
											<tr>
												<td>
													<div id="Events" style="background: #ffffff; height: 115px; width: 190px; border: 1px solid #7b9ebd; overflow-y: auto; overflow-x: hidden;">
														<table cellpadding="2" cellspacing="0" width="100%">
															<tr style="display: none;">
																<td class="hand"></td>
															</tr>
															<tr onclick="SelectEventRow();" ondblclick="EditEventHandler();" value="onchange">
																<td nowrap class="hand">onChange</td>
															</tr>
														</table>
													</div>
												</td>
												<td valign="top">
													<button class="edit" onclick="EditEventHandler();"><!-Edit->编辑</button>
												</td>
											</tr>
										</table>
									</fieldset>
									<br>
								</div>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td class="buttons">
					<button id="btnDialogOk" onclick="Ok();">确定</button>
					<span>&nbsp;</span>
					<button id="btnDialogCancel" onclick="Cancel();">取消</button>
				</td>
			</tr>
		</table>
	</form>
</body>
</html>
